//
//  XHHTTPResponse.m
//  XHNetwork
//
//  Created by xinph on 2020/3/11.
//  Copyright © 2020 xinph. All rights reserved.
//

#import "XHHTTPResponse.h"
#import "XHHTTPServiceConstant.h"

@interface XHHTTPResponse ()

/// The parsed self-definition object corresponding to the API response.
/// The developer need care this data
@property (nonatomic, readwrite, strong) id parsedResult;
/// 自己服务器返回的状态码
@property (nonatomic, readwrite, assign) XHHTTPResponseCode code;
/// 自己服务器返回的信息
@property (nonatomic, readwrite, copy) NSString *msg;
@end

@implementation XHHTTPResponse

- (instancetype)initWithResponseObject:(id)responseObject parsedResult:(id)parsedResult
{
    self = [super init];
    if (self) {
        self.parsedResult = parsedResult ?:NSNull.null;
        self.code = [responseObject[XHHTTPServiceResponseCodeKey] integerValue];
        self.msg = responseObject[XHHTTPServiceResponseMsgKey];
    }
    return self;
}
@end
